%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/v4/simple-relations-head-tail"
    Bucket0("Bucket 0 (root)<br /><br />1: 65, 69<br />ᐳ: 6, 8, 9, 73, 74, 10, 28, 32<br />2: 11, 57, 61<br />3: PgSelect[7], PgSelectRows[14]<br />ᐳ: 58, 62, 66, 70<br />4: PgSelectRows[13]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 58, 62, 66, 70<br /><br />ROOT __Item{1}ᐸ13ᐳ[15]<br />1: <br />ᐳ: 16, 59, 63, 67, 71, 19, 21, 60, 64, 68, 72<br />2: 37, 38, 39, 40"):::bucket
    Bucket2("Bucket 2 (listItem)<br /><br />ROOT __Item{2}ᐸ14ᐳ[17]"):::bucket
    Bucket3("Bucket 3 (listItem)<br /><br />ROOT __Item{3}ᐸ37ᐳ[41]"):::bucket
    Bucket4("Bucket 4 (listItem)<br /><br />ROOT __Item{4}ᐸ38ᐳ[43]"):::bucket
    Bucket5("Bucket 5 (listItem)<br /><br />ROOT __Item{5}ᐸ39ᐳ[45]"):::bucket
    Bucket6("Bucket 6 (listItem)<br /><br />ROOT __Item{6}ᐸ40ᐳ[47]"):::bucket
    end
    Bucket0 --> Bucket1 & Bucket2
    Bucket1 --> Bucket3 & Bucket4 & Bucket5 & Bucket6

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸpersonᐳ"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgSelectInlineApply57["PgSelectInlineApply[57∈0] ➊<br />More deps:<br />- Constantᐸ2ᐳ[73]"]:::plan
    PgSelectInlineApply61["PgSelectInlineApply[61∈0] ➊"]:::plan
    PgSelectInlineApply65["PgSelectInlineApply[65∈0] ➊"]:::plan
    PgSelectInlineApply69["PgSelectInlineApply[69∈0] ➊"]:::plan
    Object10 & PgSelectInlineApply57 & PgSelectInlineApply61 & PgSelectInlineApply65 & PgSelectInlineApply69 --> PgSelect7
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    __InputObject28{{"__InputObject[28∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[6]<br />- Constantᐸ'Large bet on myself in round one.'ᐳ[74]"}}:::plan
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    PgSelect11[["PgSelect[11∈0] ➊<br />ᐸcompound_keyᐳ"]]:::plan
    Object10 --> PgSelect11
    PgSelectRows13[["PgSelectRows[13∈0] ➊"]]:::plan
    PgSelect7 --> PgSelectRows13
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect11 --> PgSelectRows14
    ApplyInput32{{"ApplyInput[32∈0] ➊"}}:::plan
    __InputObject28 --> ApplyInput32
    Access58{{"Access[58∈0] ➊<br />ᐸ7.m.subqueryDetailsFor24ᐳ"}}:::plan
    PgSelect7 --> Access58
    ApplyInput32 --> PgSelectInlineApply61
    Access62{{"Access[62∈0] ➊<br />ᐸ7.m.subqueryDetailsFor30ᐳ"}}:::plan
    PgSelect7 --> Access62
    Access66{{"Access[66∈0] ➊<br />ᐸ7.m.subqueryDetailsFor33ᐳ"}}:::plan
    PgSelect7 --> Access66
    Access70{{"Access[70∈0] ➊<br />ᐸ7.m.subqueryDetailsFor35ᐳ"}}:::plan
    PgSelect7 --> Access70
    List59{{"List[59∈1]<br />ᐸ58,15ᐳ"}}:::plan
    __Item15[/"__Item[15∈1]<br />ᐸ13ᐳ"\]:::itemplan
    Access58 & __Item15 --> List59
    List63{{"List[63∈1]<br />ᐸ62,15ᐳ"}}:::plan
    Access62 & __Item15 --> List63
    List67{{"List[67∈1]<br />ᐸ66,15ᐳ"}}:::plan
    Access66 & __Item15 --> List67
    List71{{"List[71∈1]<br />ᐸ70,15ᐳ"}}:::plan
    Access70 & __Item15 --> List71
    PgSelectRows13 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸpersonᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    PgClassExpression19{{"PgClassExpression[19∈1]<br />ᐸ__person__.”id”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression19
    PgClassExpression21{{"PgClassExpression[21∈1]<br />ᐸ__person__...full_name”ᐳ"}}:::plan
    PgClassExpression19 o--o PgClassExpression21
    PgSelectRows37[["PgSelectRows[37∈1]"]]:::plan
    Lambda60{{"Lambda[60∈1]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda60 --> PgSelectRows37
    PgSelectRows38[["PgSelectRows[38∈1]"]]:::plan
    Lambda64{{"Lambda[64∈1]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda64 --> PgSelectRows38
    PgSelectRows39[["PgSelectRows[39∈1]"]]:::plan
    Lambda68{{"Lambda[68∈1]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda68 --> PgSelectRows39
    PgSelectRows40[["PgSelectRows[40∈1]"]]:::plan
    Lambda72{{"Lambda[72∈1]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda72 --> PgSelectRows40
    List59 --> Lambda60
    List63 --> Lambda64
    List67 --> Lambda68
    List71 --> Lambda72
    __Item17[/"__Item[17∈2]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item17
    PgSelectSingle18{{"PgSelectSingle[18∈2]<br />ᐸcompound_keyᐳ"}}:::plan
    __Item17 --> PgSelectSingle18
    PgClassExpression20{{"PgClassExpression[20∈2]<br />ᐸ__compound...rson_id_1”ᐳ"}}:::plan
    PgSelectSingle18 --> PgClassExpression20
    PgClassExpression22{{"PgClassExpression[22∈2]<br />ᐸ__compound...rson_id_2”ᐳ"}}:::plan
    PgClassExpression20 o--o PgClassExpression22
    __Item41[/"__Item[41∈3]<br />ᐸ37ᐳ"\]:::itemplan
    PgSelectRows37 ==> __Item41
    PgSelectSingle42{{"PgSelectSingle[42∈3]<br />ᐸpostᐳ"}}:::plan
    __Item41 --> PgSelectSingle42
    PgClassExpression49{{"PgClassExpression[49∈3]<br />ᐸ__post__.”headline”ᐳ"}}:::plan
    PgSelectSingle42 --> PgClassExpression49
    PgClassExpression53{{"PgClassExpression[53∈3]<br />ᐸ__post__.”author_id”ᐳ"}}:::plan
    PgClassExpression49 o--o PgClassExpression53
    __Item43[/"__Item[43∈4]<br />ᐸ38ᐳ"\]:::itemplan
    PgSelectRows38 ==> __Item43
    PgSelectSingle44{{"PgSelectSingle[44∈4]<br />ᐸpostᐳ"}}:::plan
    __Item43 --> PgSelectSingle44
    PgClassExpression50{{"PgClassExpression[50∈4]<br />ᐸ__post__.”headline”ᐳ"}}:::plan
    PgSelectSingle44 --> PgClassExpression50
    PgClassExpression54{{"PgClassExpression[54∈4]<br />ᐸ__post__.”author_id”ᐳ"}}:::plan
    PgClassExpression50 o--o PgClassExpression54
    __Item45[/"__Item[45∈5]<br />ᐸ39ᐳ"\]:::itemplan
    PgSelectRows39 ==> __Item45
    PgSelectSingle46{{"PgSelectSingle[46∈5]<br />ᐸcompound_keyᐳ"}}:::plan
    __Item45 --> PgSelectSingle46
    PgClassExpression51{{"PgClassExpression[51∈5]<br />ᐸ__compound...rson_id_1”ᐳ"}}:::plan
    PgSelectSingle46 --> PgClassExpression51
    PgClassExpression55{{"PgClassExpression[55∈5]<br />ᐸ__compound...rson_id_2”ᐳ"}}:::plan
    PgClassExpression51 o--o PgClassExpression55
    __Item47[/"__Item[47∈6]<br />ᐸ40ᐳ"\]:::itemplan
    PgSelectRows40 ==> __Item47
    PgSelectSingle48{{"PgSelectSingle[48∈6]<br />ᐸcompound_keyᐳ"}}:::plan
    __Item47 --> PgSelectSingle48
    PgClassExpression52{{"PgClassExpression[52∈6]<br />ᐸ__compound...rson_id_1”ᐳ"}}:::plan
    PgSelectSingle48 --> PgClassExpression52
    PgClassExpression56{{"PgClassExpression[56∈6]<br />ᐸ__compound...rson_id_2”ᐳ"}}:::plan
    PgClassExpression52 o--o PgClassExpression56

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,PgSelect11,PgSelectRows13,PgSelectRows14,__InputObject28,ApplyInput32,PgSelectInlineApply57,Access58,PgSelectInlineApply61,Access62,PgSelectInlineApply65,Access66,PgSelectInlineApply69,Access70 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16,PgClassExpression19,PgClassExpression21,PgSelectRows37,PgSelectRows38,PgSelectRows39,PgSelectRows40,List59,Lambda60,List63,Lambda64,List67,Lambda68,List71,Lambda72 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,__Item17,PgSelectSingle18,PgClassExpression20,PgClassExpression22 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item41,PgSelectSingle42,PgClassExpression49,PgClassExpression53 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,__Item43,PgSelectSingle44,PgClassExpression50,PgClassExpression54 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,__Item45,PgSelectSingle46,PgClassExpression51,PgClassExpression55 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,__Item47,PgSelectSingle48,PgClassExpression52,PgClassExpression56 bucket6

